package com.xcc;

import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
import org.jetbrains.annotations.NotNull;

public class MyTypedActionHandler implements TypedActionHandler {
    @Override
    public void execute(@NotNull Editor editor, char c, @NotNull DataContext dataContext) {
        if (oldHandler != null) oldHandler.execute(editor, c, dataContext);
        System.out.println("-xcc->" + c + "<-xcc-");
        switch (c) {
            /*default:
                XccPlayer.of("raw/hc.mp3").start();
                break;*/
            case ' ':
                XccPlayer.of("raw/kg.mp3").start();
                break;
            case 'Z':
            case 'z':
                XccPlayer.of("raw/z.mp3").start();
                break;
            case 'X':
            case 'x':
                XccPlayer.of("raw/x.mp3").start();
                break;
            case 'C':
            case 'c':
                XccPlayer.of("raw/c.mp3").start();
                break;
            case 'V':
            case 'v':
                XccPlayer.of("raw/v.mp3").start();
                break;
            case 'B':
            case 'b':
                XccPlayer.of("raw/b.mp3").start();
                break;
            case 'N':
            case 'n':
                XccPlayer.of("raw/n.mp3").start();
                break;
            case 'M':
            case 'm':
                XccPlayer.of("raw/m.mp3").start();
                break;
            case 'A':
            case 'a':
                XccPlayer.of("raw/a.mp3").start();
                break;
            case 'S':
            case 's':
                XccPlayer.of("raw/s.mp3").start();
                break;
            case 'D':
            case 'd':
                XccPlayer.of("raw/d.mp3").start();
                break;
            case 'F':
            case 'f':
                XccPlayer.of("raw/f.mp3").start();
                break;
            case 'G':
            case 'g':
                XccPlayer.of("raw/g.mp3").start();
                break;
            case 'H':
            case 'h':
                XccPlayer.of("raw/h.mp3").start();
                break;
            case 'J':
            case 'j':
                XccPlayer.of("raw/j.mp3").start();
                break;
            case 'K':
            case 'k':
                XccPlayer.of("raw/k.mp3").start();
                break;
            case 'L':
            case 'l':
                XccPlayer.of("raw/l.mp3").start();
                break;
            case 'Q':
            case 'q':
                XccPlayer.of("raw/q.mp3").start();
                break;
            case 'W':
            case 'w':
                XccPlayer.of("raw/w.mp3").start();
                break;
            case 'E':
            case 'e':
                XccPlayer.of("raw/e.mp3").start();
                break;
            case 'R':
            case 'r':
                XccPlayer.of("raw/r.mp3").start();
                break;
            case 'T':
            case 't':
                XccPlayer.of("raw/t.mp3").start();
                break;
            case 'Y':
            case 'y':
                XccPlayer.of("raw/y.mp3").start();
                break;
            case 'U':
            case 'u':
                XccPlayer.of("raw/u.mp3").start();
                break;
            case 'I':
            case 'i':
                XccPlayer.of("raw/i.mp3").start();
                break;
            case 'O':
            case 'o':
                XccPlayer.of("raw/o.mp3").start();
                break;
            case 'P':
            case 'p':
                XccPlayer.of("raw/p.mp3").start();
                break;
            case '1':
                XccPlayer.of("raw/1.mp3").start();
                break;
            case '2':
                XccPlayer.of("raw/2.mp3").start();
                break;
            case '3':
                XccPlayer.of("raw/3.mp3").start();
                break;
            case '4':
                XccPlayer.of("raw/4.mp3").start();
                break;
            case '5':
                XccPlayer.of("raw/5.mp3").start();
                break;
            case '6':
                XccPlayer.of("raw/6.mp3").start();
                break;
            case '7':
                XccPlayer.of("raw/7.mp3").start();
                break;
            case '8':
                XccPlayer.of("raw/8.mp3").start();
                break;
            case '9':
                XccPlayer.of("raw/9.mp3").start();
                break;
            case '0':
                XccPlayer.of("raw/0.mp3").start();
                break;
        }
    }

    private TypedActionHandler oldHandler;

    public void setOldHandler(TypedActionHandler oldHandler) {
        this.oldHandler = oldHandler;
    }
}
